<template>
    <div class="container">container</div>
</template>

<script setup>
import { onBeforeMount, onMounted } from 'vue'
const container = document.querySelector('.container')
console.log(container) // null

onBeforeMount(() => {
    const container = document.querySelector('.container')
    console.log(container) // ???
})

onMounted(() => {
    const container = document.querySelector('.container')
    console.log(container)  // DOM
})
</script>

<style></style>